#coding=utf-8
import os
os.environ['DJANGO_SETTINGS_MODULE'] = 'ssr.settings'
from ssr.seq.models import SeqFasta

from Bio import SeqIO

datafile = 'seq.fa'
for seq_record in SeqIO.parse(open(datafile), "fasta"):
    sf = SeqFasta()
    sf.gi = seq_record.id.split('|')[1]
    sf.description = seq_record.description
    sf.seq = seq_record.seq.tostring()
    sf.save()
    

